#include "Texture.h"
#include "PerlinNoise.h"
// #include "Cimg.h"
#include <iostream>
#include <cmath>
#include <cfloat>


Texture::Texture()
{
	genBasicHeightMap();
}

void Texture::genBasicHeightMap()
{
	int R,G,B;

	PerlinNoise perl;
	perl = PerlinNoise(0.5,2.0,5);
	for (int i=0;i<32;i++)
	{
		for (int j=0;j<32;j++)
		{
			heightMap[i][j] 
			= perl.perlNoise2D(i,j,true);
			heightMap[i][j] << 8;
			heightMap[i][j] += perl.perlNoise2D(-i,j,true);
			heightMap[i][j] << 8;
			heightMap[i][j] += perl.perlNoise2D(i,-j,true);
			heightMap[i][j] << 8;
			heightMap[i][j] += 255;
		}
	}
}
	int Texture::getHeightMap(int x, int y)
	{
		return heightMap[x][y]; 
	}

	/*int main(void)
	{
		Texture tex;
		tex = Texture();
		for (int i=0; i<256;i++)
		{
			for(int j=0; j<256; j++)
			{
				std::cout << tex.getHeightMap(i,j);
				std::cout << "\n";
			}
		}*/
	
